package com.itheima.object;

public class Students {
    //属性,成员变量
    private String name;
    int age;
    //设置值
    public void setName(String name){
        if(name != "张三"){
            System.out.println("您输入的有误");
        }else {
            this.name = name;
        }
    }
    public String getName(){
        return name;
    }
   //行为:学习
    //成员方法:去掉static关键字
    public void study() {
        System.out.println("学习");
    }
    public void eat(){
        System.out.println("次饭");
    }
    public void sleep(){
        System.out.println("睡觉");
    }
}
